<template>
    <div class="drag-bar" style="-webkit-app-region: none;">
        <!-- 缩小 -->
        <i class="icon el-icon-minus el-input__icon" slot="prefix" @click="minimizeClick"> </i>
        <i class="icon el-icon-full-screen el-input__icon" slot="prefix" @click="maximizeClick" v-if="!login"> </i>
        <!-- 登录 -->
        <i class="icon el-icon-close el-input__icon" slot="prefix" @click="quitExeClick" v-if="login"> </i>
        <!-- 首页 -->
        <i class="icon el-icon-close el-input__icon" slot="prefix" @click="hideClick" v-if="!login"> </i>
        <!-- <i class="el-icon-s-opportunity el-input__icon" slot="prefix" @click="testClick()"> </i> -->
    </div>
</template>
<script>


export default {
    name: 'dragBar',
    data() {

        return {
            mainWindow: null
        }
    },
    created() {
        this.mainWindow = window.electron
    },
    props: {
        login: {
            type: Boolean,
            default: false
        }
    },
    methods: {
        hideClick() {
            this.$ipcRenderer.send("hide-window");

        },
        testClick() {
            // 测试
            this.$ipcRenderer.send("reset-window", 500, 700);
        },
        minimizeClick() {
            // 最小化
            this.$ipcRenderer.send("minimize-window");
        },
        maximizeClick() {
            // 最大化
            this.$ipcRenderer.send("maximize-window");
        },
        quitExeClick() {
            // 关闭
            this.$ipcRenderer.send("close-window");
        }
    }
}
</script>
<style lang="scss" scoped>
.drag-bar {
    height: 40px;
    width: 100%;
    position: absolute;
    z-index: 3;
    top: 0;
    //设置可以拖拽的区域
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 105px;
    right: 0;

    .icon {
        // -webkit-app-region: no-drag;
        cursor: pointer;
        font-size: 25px;
        margin: 0 5px;
    }
}
</style>
